package com.hut.blog.mapper;

import com.hut.blog.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    /**
     * 根据用户名查询用户信息
     * @param userName
     * @return
     */
    @Select("select id, user_name, password, github_url, delete_flag, create_time, update_time from user where " +
            "delete_flag =0 and user_name = #{userName}")
    UserInfo getUserInfoByUserName(String userName);

    /**
     * 根据id来查询用户信息
     * @param id
     * @return
     */
    @Select("select id, user_name, password, github_url, delete_flag, create_time, update_time from user where " +
            "delete_flag =0 and id = #{id}")
    UserInfo getUserInfoById(Integer id);

}
